from MsgProcess import MsgProcess, MsgType
import time,os
import RPi.GPIO as GPIO
from threading import Thread

class Name(MsgProcess):

    def main(self):
        pin=15
        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(pin,GPIO.IN)
        key=1#
        while 1 :
            if GPIO.input(pin)==0 and key==0:#
                self.send(MsgType=MsgType.Awake, Receiver='ControlCenter')
                print("唤醒",time.time())
                key=1#
                
            if GPIO.input(pin)==1:#
                key=0#


            time.sleep(0.1)        
        

    def Start(self, message):
        print("唤醒芯片驱动完成")
        Thread(target=self.main).start()

            
